<template>
  <div class="homecon">
    <!-- 侧边导航栏 -->
    <el-col :span="12">
      <el-menu default-active="2" class="el-menu-vertical-demo leftmenu">
        <el-menu-item>
          <span slot="title">推荐</span>
        </el-menu-item>
        <el-menu-item>
          <span slot="title">动态</span>
        </el-menu-item>
        <el-menu-item>
          <span slot="title">IT世界</span>
        </el-menu-item>
        <el-menu-item>
          <span slot="title">Java</span>
        </el-menu-item>
        <el-menu-item>
          <span slot="title">5G</span>
        </el-menu-item>
        <el-menu-item>
          <span slot="title">其他</span>
        </el-menu-item>
      </el-menu>
    </el-col>

    <!-- 中间内容区域 -->
    <div class="content">
      <!-- <div class="swipe">
        <mt-swipe :auto="4000" class="swipe-img">
          <mt-swipe-item v-for="item in swipeImg" :key="item.id"
            ><img :src="item.img" alt=""
          /></mt-swipe-item>
        </mt-swipe>
      </div> -->
      <div class="home-content">
        <ul>
          <li v-for="item in homeContent" :key="item.id">
            <router-link :to="'/home/content/' + item.id">
              <div class="subtitle">{{ item.title }}</div>
              <div class="subinfo">{{ item.info }}</div>
            </router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      swipeImg: [],
      homeContent: []
    };
  },
  created() {
    this.getSwipeImg();
    this.getHomeContent();
  },
  methods: {
    getSwipeImg() {
      this.axios.get("/home/swip").then((response) => {
        // console.log(response.data);
        this.swipeImg = response.data.data;
      });
    },
    getHomeContent() {
      this.axios.get("/home/content").then((response) => {
        // console.log(response.data);
        this.homeContent = response.data.data;
        // console.log(this.homeContent.id)
        this.id = this.homeContent.id;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.homecon {
  width: 100%;
  height: 100%;
  background-color: #eeeeee;
  display: flex;
  justify-content: center;
  .el-col {
    margin: 4px 10px 4px 30px;
    width: 80px;
    padding: 0px;
    height: 340px;
    background-color: #fff;
    border: 1px solid #999;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    .leftmenu {
      text-align: center;
    }
  }
  .content {
    width: 90%;
    margin: 4px 30px 4px 10px;
    .home-content {
      ul {
        padding: 0px;
        margin: 0px;
      }
      a{
          text-decoration: none;
      }
      li {
        list-style: none;
        border: 1px;
        box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.1);
        height: 50px;
      }
      .subtitle {
        height: 24px;
        line-height: 24px;
        font-size: 16px;
        font-weight: 3em;
      }
      .subinfo {
        height: 18px;
        line-height: 18px;
        font-size: 12px;
      }
    }
  }
}
</style>